package com.briup.recognition.web.controller;

import com.briup.recognition.bean.BasePrivilege;
import com.briup.recognition.service.IBasePrivilegeService;
import com.briup.recognition.utils.Message;
import com.briup.recognition.utils.MessageUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @program: recognition
 * @description:
 * @author: lipeian
 * @create: 2021-03-28 17:10
 **/
@RestController
@RequestMapping("/baseprivilege")
public class BasePrivilegeController {

    @Autowired
    private IBasePrivilegeService basePrivilegeService;

    @GetMapping("query")
    public Message query(){
        List<BasePrivilege> list = basePrivilegeService.query();
        return MessageUtil.success(list);
    }

    @PostMapping("saveOrUpdate")
    public Message saveOrupdate(BasePrivilege basePrivilege){
        basePrivilegeService.savaOrUpdate(basePrivilege);
        return MessageUtil.success("操作成功");
    }

    @DeleteMapping("deleteById")
    public Message deleteById(long id){
        basePrivilegeService.deleteById(id);
        return MessageUtil.success("删除成功");
    }

}
